package day4;

import java.util.Arrays;

public
class TestObject {
    String name;
    int age;

    public
    TestObject(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public
    TestObject() {
    }

    public static void main(String[] args) {
        TestObject s = new TestObject("day4", 18);
        System.out.println(s.toString());
        TestObject s1=new TestObject();
        TestObject s2=new TestObject();
        TestObject s3=s1;

        System.out.println("s1:"+s1.hashCode());
        System.out.println("s2:"+s2.hashCode());
        System.out.println("s3:"+s3.hashCode());

        //基本类型比较
        Integer a=10;
        Integer b=new Integer(10);
        Long c=10L;
        System.out.println("a:"+a.hashCode());
        System.out.println("b:"+b.hashCode());
        System.out.println("c:"+c.hashCode());

        //String类型比较
        String str1="abc";
        String str2=new String("abc");
        System.out.println("str1:"+str1.hashCode());
        System.out.println("str2:"+str2.hashCode());
        String str3="重地";
        String str4="通话";
        System.out.println("str3:"+str3.hashCode());
        System.out.println("str4:"+str4.hashCode());

    }
    public String toString() {
        return "name:+" + name + "age:" + age + "";
    }
}
